home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / e / modulesmc.lha / ModulesMC1 / realf.e < prev    next >
Encoding:
Text File  |  1994-11-21  |  513 b   |  23 lines

  1. /* here's another RealF, in case your version isn't working  */
  2.  
  3. OPT MODULE
  4. OPT EXPORT
  5.  
  6. PROC realf(str,float,n=4)
  7. DEF neg=FALSE, s ,p=10000.
  8. s:='\s\d.\z\d[4]'
  9. IF (n>7) OR (n<0) THEN n:=4
  10. IF n<>4
  11.   PutChar(s+8,n+48)
  12.   PutChar(s+10,n+48)
  13.   p:=[1., 10., 100., 1000., 10000., 100000., 1000000., 10000000.]
  14.   p:=Long(Shl(n,2)+p)
  15. ENDIF
  16. IF float<0
  17.   BCLR #31,float     /* converts ieeesp format into positive  */
  18.   neg:=TRUE
  19. ENDIF
  20.    StringF(str,s,IF neg THEN '-' ELSE '',
  21.       (!float!),!float-(!float!!)*p!)
  22. ENDPROC str
  23.